<?php
    $_session = Mage::getSingleton('customer/session');
    $_customer = $_session->getCustomer();
    $_products = $this->getRecentlyViewedProducts();
    $_productCollection = array();
    $_productCollection = $_products;
    $_currentCategory = Mage::registry('current_category');
    if(!$_currentCategory) Mage::register('current_category',Mage::getModel('catalog/category')->load(12));
    $catalogMod  = Mage::getModel('catalog/category');
    $_helper = $this->helper('catalog/output');
    $zgbHelper = Mage::helper('zgb');
    $_catalogHp  = $this->helper('catalog/category');
?>
<div  class="row main">
    <ul class="breadcrumbs">
        <li>
            <a href="http://www.qingsonglaoban.com/index.php/" title="前往主页">主页</a>
            <span>></span>
        </li>
        <li><strong><?php echo $this->__('最近查看商品') ?></strong></li>
    </ul>

    <div class="product-screen">

        <div class="nav">
            <div class="row title">
                <h3>最近购买</h3>
                <h4><a href="#">商品分类</a></h4>
            </div>
            <?php if(!$_productCollection->count()): ?>
                <p class="note-msg"><?php echo $this->__('您最近没有购买任何产品.') ?></p>
            <?php else : ?>
            <div class="row product-section recent">
                <div class="line"></div>
                <ul class="product-list">
                <?php foreach ($_productCollection as $_product): ?>
                    <li>
                        <div class="product-wrap">
                            <div class="product-image">
                                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
                                    <img class="lazy" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(210); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"/>
                                </a>
                                <?php if($zgbHelper->hasTag($_product)): ?>
                                    <div class="product-sale-tag">
                                        <img src="<?php echo $zgbHelper->getSaleTagUrl($_product, $this->getSkinUrl('images')); ?>" alt="">
                                    </div>
                                <?php endif; ?>
                            </div>
                            <div class="product-shop">
                                <h3><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h3>
                                <div class="row">
                                     <?php if(number_format($_product->getPrice(),2) <= number_format($_product->getFinalPrice(),2)): ?>
                                        <span class="col-2 special-price">
                                            ￥&nbsp;<?php echo number_format($_product->getPrice(),2); ?>
                                        </span>
                                    <?php else : ?>
                                        <span class="col-2 old-price" >
                                            ￥&nbsp;<?php echo number_format($_product->getPrice(),2); ?>
                                        </span>
                                        <span class="col-2 special-price">
                                            ￥&nbsp;<?php echo number_format($_product->getFinalPrice(),2); ?>
                                        </span>
                                    <?php endif; ?>
                                </div>
                                <div class="row fill-box" id="datactions" data-action="<?php echo $this->getUrl('checkout/cart/addAjax',array('product'=>$_product->getId())); ?>">
                                    <div class="col-2 qty-area">
                                        <span class="reduce">-</span>
                                        <div class="qty-input">
                                            <input type="text" name="qty" id="qty" value="1"/>
                                        </div>
                                        <span class="add">+</span>
                                    </div>
                                    <div class="col-2">
                                        <button class="add-cart-button">加入购物车</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </li>
                <?php endforeach; ?>
                </ul>
            </div>
            <?php endif; ?>
            <div class="line"></div>
        </div>
    </div>
</div>